/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComponent;
import model.Base;
import view.MainWindow;
import view.ChangePasswordWindow;
import view.NewDocumentWindow;
import view.NewUserWindow;
import view.StaffMemberView;

/**
 *
 * @author Ira
 */
public class StaffMemberMenuController implements ActionListener {

	private Base model;
	private StaffMemberView view;

	public StaffMemberMenuController(Base model, StaffMemberView view, MainWindow mainWindow) {
		this.model = model;
		this.view = view;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		JComponent c = (JComponent)e.getSource();
		String command = c.getName();
		
		if(command.equals(StaffMemberView.MENU_ABOUT)) {
			
		}
		else if(command.equals(StaffMemberView.MENU_ADD_DOC)) {
			new NewDocumentWindow(this.model);
		}
		else if(command.equals(StaffMemberView.MENU_ADD_USER)) {
			new NewUserWindow(this.model);          
		}
		else if(command.equals(StaffMemberView.MENU_DECO)) {
			this.view.logout();
		}
		else if(command.equals(StaffMemberView.MENU_CHANGE_PASS)) {
			new ChangePasswordWindow(this.model);
		}
		else if(command.equals(StaffMemberView.MENU_QUIT)) {
			this.model.serialize();
			System.exit(0);
		}
		else if(command.equals(StaffMemberView.MENU_SEARCH_DOC)) {
			
		}
		else if(command.equals(StaffMemberView.MENU_SEARCH_USER)) {
			
		}
		
		
	}
	
}
